package com.springboot.exceptions.message;

import com.springboot.enums.CodeEnum;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;

/**
 * 接口简易返回信息
 *
 * @author wangyx
 */
@Data
@SuppressWarnings("unused")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SimpleMessage implements Serializable {
    private static final long serialVersionUID = -2957516153008725933L;
    private Integer code;
    private String msg;
    private Long expire;

    public SimpleMessage() {
    }

    public SimpleMessage(Integer errorCode, String errorMsg) {
        this.code = errorCode;
        this.msg = errorMsg;
    }

    public SimpleMessage(CodeEnum code) {
        this.code = code.getCode();
        this.msg = code.getMessage();
    }

    public SimpleMessage(CodeEnum code, String errorMsg) {
        this.code = code.getCode();
        this.msg = errorMsg;
    }

    public SimpleMessage(CodeEnum code, String errorMsg, Long expire) {
        this.code = code.getCode();
        this.msg = errorMsg;
        this.expire = expire;
    }
}
